home *** CD-ROM | disk | FTP | other *** search
/ X User Tools / X User Tools (O'Reilly and Associates)(1994).ISO / sun4c / archive / tcltk.z / tcltk / man / cat3 / TimerHndlr.3 < prev    next >
Text File  |  1994-09-20  |  4KB  |  133 lines

  1.  
  2.  
  3.  
  4. Tk_CreateTimerHandler(3T)k Library Procedures
  5.  
  6.  
  7.  
  8. _________________________________________________________________
  9.  
  10. NAME
  11.      Tk_CreateTimerHandler, Tk_DeleteTimerHandler - call  a  pro-
  12.      cedure at a given time
  13.  
  14. SYNOPSIS
  15.      #include <tk.h>
  16.  
  17.      Tk_TimerToken
  18.      Tk_CreateTimerHandler(_m_i_l_l_i_s_e_c_o_n_d_s, _p_r_o_c, _c_l_i_e_n_t_D_a_t_a)
  19.  
  20.      Tk_DeleteTimerHandler(_t_o_k_e_n)
  21.  
  22. ARGUMENTS
  23.      int             _m_i_l_l_i_s_e_c_o_n_d_s   (in)      How    many    mil-
  24.                                               liseconds  to  wait
  25.                                               before     invoking
  26.                                               _p_r_o_c.
  27.  
  28.      Tk_TimerProc    *_p_r_o_c          (in)      Procedure to invoke
  29.                                               after  _m_i_l_l_i_s_e_c_o_n_d_s
  30.                                               have elapsed.
  31.  
  32.      ClientData      _c_l_i_e_n_t_D_a_t_a     (in)      Arbitrary  one-word
  33.                                               value  to  pass  to
  34.                                               _p_r_o_c.
  35.  
  36.      Tk_TimerToken   _t_o_k_e_n          (in)      Token           for
  37.                                               previously-created
  38.                                               timer handler  (the
  39.                                               return  value  from
  40.                                               some previous  call
  41.                                               to
  42.                                               Tk_CreateTimerHandler).
  43. _________________________________________________________________
  44.  
  45.  
  46. DESCRIPTION
  47.      Tk_CreateTimerHandler arranges for _p_r_o_c to be invoked  at  a
  48.      time  _m_i_l_l_i_s_e_c_o_n_d_s milliseconds in the future.  The callback
  49.      to   _p_r_o_c   will    be    made    by    Tk_DoOneEvent,    so
  50.      Tk_CreateTimerHandler   is  only  useful  in  programs  that
  51.      dispatch events through Tk_DoOneEvent or  through  other  Tk
  52.      procedures  that  call  Tk_DoOneEvent,  such as Tk_MainLoop.
  53.      The call to _p_r_o_c may not be made at the exact time given  by
  54.      _m_i_l_l_i_s_e_c_o_n_d_s:  it will be made at the next opportunity after
  55.      that time.  For example, if Tk_DoOneEvent isn't called until
  56.      long after the time has elapsed, or if there are other pend-
  57.      ing events to process before the call to _p_r_o_c, then the call
  58.      to _p_r_o_c will be delayed.
  59.  
  60.  
  61.  
  62.  
  63. Tk                                                              1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. Tk_CreateTimerHandler(3T)k Library Procedures
  71.  
  72.  
  73.  
  74.      _P_r_o_c should have arguments and return value that  match  the
  75.      type Tk_TimerProc:
  76.           typedef void Tk_TimerProc(ClientData _c_l_i_e_n_t_D_a_t_a);
  77.      The _c_l_i_e_n_t_D_a_t_a parameter to _p_r_o_c is a copy of the _c_l_i_e_n_t_D_a_t_a
  78.      argument  given  to Tcl_CreateTimerHandler when the callback
  79.      was created.  Typically, _c_l_i_e_n_t_D_a_t_a points to a data  struc-
  80.      ture  containing application-specific information about what
  81.      to do in _p_r_o_c.
  82.  
  83.      Tk_DeleteTimerHandler may be called to delete a  previously-
  84.      created  timer handler.  It deletes the handler indicated by
  85.      _t_o_k_e_n so that no call to _p_r_o_c will be made;  if that handler
  86.      no  longer  exists (e.g. because the time period has already
  87.      elapsed    and    _p_r_o_c    has     been     invoked)     then
  88.      Tk_DeleteTimerHandler does nothing.
  89.  
  90.  
  91. KEYWORDS
  92.      callback, clock, handler, timer
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129. Tk                                                              2
  130.  
  131.  
  132.  
  133.